/*=============================================================================
*
*   Copyright (C) 2020 All rights reserved.
*
*   Filename:		indexed.hpp
*
*   Author: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Date: 2020-01-17 16:53
*
*   Last Editors: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Last modified:	2020-03-04 23:44
*
*   Description:
*
=============================================================================*/
#ifndef INDEXING_H
#define INDEXING_H

#include "../types.hpp"

namespace geoxfem {
namespace util {

struct Indexed {
  /*constructors and destructor{{{*/

  /**
   * @brief Indexed
   *
   * @param n
   */
  Indexed() : m_index{-1} {}
  Indexed(const int& n) : m_index{n} {}
  Indexed(const Indexed&) = default;
  Indexed(Indexed&&)      = default;
  ~Indexed()              = default;
  Indexed& operator=(const Indexed&) = default;
  Indexed& operator=(Indexed&&) = default;
  /*}}}*/
  /*compare{{{*/
  bool operator<(const geoxfem::util::Indexed& rhs) const {
    return m_index < rhs.m_index;
  }
  bool operator>(const geoxfem::util::Indexed& rhs) const {
    return m_index > rhs.m_index;
  }
  /*}}}*/
  /*memeber access{{{*/

  /**
   * @brief getIndex
   *
   * @return
   */
  int getIndex() const {
    return m_index;
  }
  /**
   * @brief setIndex
   */
  void setIndex(const int& n) {
    m_index = n;
  }
  /*}}}*/

private:
  int m_index;
};

}  // namespace util
}  // namespace geoxfem

#endif
